08. System Data
System Data
Linux stores a lot of system data in files within the /proc
directory. Most of the data that this project requires exists in those files.
Operating System
Information about the operating system exists outside of the /proc
directory, in the /etc/os-release
file.
There are several strings from which to choose here, but the most obvious is the value specified by "PRETTY_NAME".
Kernel
Information about the kernel exists /proc/version
file.
Memory Utilization
Information about memory utilization exists in the /proc/meminfo
file.
There are a variety of ways to use this data to calculate memory utilization.
Hisham H. Muhammad, the author of htop, wrote a Stack Overflow answer about how htop calculates memory utilization from the data in /proc/meminfo
.
Use the formula that makes the most sense to you!
Total Processes
Information about the total number of processes on the system exists in the /proc/meminfo
file.
Running Processes
Information about the number of processes on the system that are currently running exists in the /proc/meminfo
file.
Up Time
Information about system up time exists in the /proc/uptime
file.
This file contains two numbers (values in seconds): the uptime of the system (including time spent in suspend) and the amount of time spent in the idle process.
From the man page for proc